import html2canvas from 'html2canvas';
/**
 * @description: html转换到canvas
 * @param {HTMLElement} element dom元素
 * @return {Promise<HTMLCanvasElement>} canvas对象
 */
export const html2canvasTool = (
  element: HTMLElement,
): Promise<HTMLCanvasElement> => {
  return new Promise((resolve, reject) => {
    html2canvas(element)
      .then((canvas) => {
        resolve(canvas);
      })
      .catch((error) => {
        reject(error);
      });
  });
};
